﻿using System;
using FileHelpers;
using SharpStockLib.Data;

namespace SharpStockLib.DataAccess.CSVMappers
{
    /// <summary>
    /// This is a mapper to read data from a Yahoo CSV file. Used by FileHelpers' CSV parser.
    /// </summary>
    [DelimitedRecord(",")]
    [IgnoreFirst(1)]
    public class YahooStockHistorical : IMapper
    {
        [FieldConverter(ConverterKind.Date, "yyyy-MM-dd")]
        public DateTime Date;

        public double Open;

        public double High;

        public double Low;

        public double Close;

        public int Volume;

        public double AdjClose;


        public IData ToIData()
        {
            return new SimpleData(Open, High, Low, Close, Volume, Date);
        }
    }
}
